package com.own.business.comment.business.service;

import com.own.business.comment.entity.bo.CommentBo;
import com.own.business.comment.entity.map.CommentMapVo;
import com.own.business.comment.entity.po.Comment;
import com.own.business.comment.entity.query.CommentQuery;
import com.own.business.comment.entity.vo.CommentVo;
import com.own.component.common.base.service.BaseService;

import java.util.List;

/**
 * CommentService
 *
 * @author chenxueli
 * @date 2023-07-03 14:15:52
 */
public interface CommentService extends BaseService<
        Comment,
        CommentBo,
        CommentVo,
        CommentMapVo,
        CommentQuery
        > {

    /**
     * 根据目标id查询评论
     *
     * @param targetId 目标id
     * @param query    查询条件
     * @return 评论列表
     */
    List<Comment> listByTargetId(Long targetId, CommentQuery query);

    /**
     * 保存评论
     *
     * @param userId   用户id
     * @param targetId 目标id
     * @param parentId 父级id
     * @param content  内容
     */
    void save(Long userId, Long targetId, Long parentId, String content);

    /**
     * 根据用户id和评论id删除评论
     *
     * @param userId    用户id
     * @param commentId 评论id
     */
    void deleteByUserId(Long userId, Long commentId);

    /**
     * 根据目标id删除评论
     *
     * @param targetId 目标id
     */
    void deleteByTargetId(Long targetId);

}

